package com.Leetcode;

import com.structure.TreeNode;

public class Index538convertST {

	public TreeNode convertBST(TreeNode root) {
		if(root == null) return null;
		convert(root);
		return root;
	}
	int val = 0;
	public void convert(TreeNode root) {
		if(root == null) return;
		convert(root.right);
		val += root.val;
		root.val = val;
		convert(root.left);
	}
}
